﻿<?php
require_once "common.php";
$pid="";
$part=$_POST[part];
$top=$_GET[top];
$fid=$_POST[fatherPart];
//echo $top;

//if($top=='true'){
//	$top=1;
//}else{
//	$top=0;
//}
if($part!=""&&$top!="")
{
	//echo $pid;
	//echo $part;
	//echo $top;
	if($top==1){
		$part = new part($pid,$part,$top);
		//echo $part->part;
		//echo $part->top;
		$res=$part->addPart();
	}elseif($top==0){
		$part = new part($pid,$part,$top);
		$res=$part->addSubpart($fid);
	}
if($res){
	//echo "添加栏目成功！";
	//echo "<script>location.href='./part_list.php'</script>";
	$redirector=new redirector('./part_list.php',3,'栏目添加成功！');
	$redirector->redirect();
	return $res;
}
//可以添加一些适当的显示提示
return false;
}else{
	echo "error!";
	$redirector=new redirector('./part_list.php',3,'栏目添加失败！');
	$redirector->redirect();
}
?>
